package com.yiren.dbaa.util;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.RadioButton;
import android.widget.TextView;

import com.yiren.backstage.currency.enums.CarStateNameEnum;
import com.yiren.dbaa.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by WANGRONGXIANG
 * on 2022/2/25
 * Describe 车辆信号的工具类
 */
public class CarSignalUtil {

    /**
     * 添加全部的车辆信号
     */
    public static List<CarStateNameEnum> getCarSignals(Context context) {
        List<CarStateNameEnum> list = new ArrayList<>();
        list.add(CarStateNameEnum.FOOT_BRAKE);
        list.add(CarStateNameEnum.SEPARATION_REUNION);
        list.add(CarStateNameEnum.PARKING_BRAKE);
        list.add(CarStateNameEnum.PASSING_LIGHT);
        list.add(CarStateNameEnum.SAFETY_BELT);
        list.add(CarStateNameEnum.HORN);
        list.add(CarStateNameEnum.CAR_DOOR);
        list.add(CarStateNameEnum.CAUTION_LIGHT);
        list.add(CarStateNameEnum.DRIVING_LAMP);
        list.add(CarStateNameEnum.DISTANCE_LIGHT);
        list.add(CarStateNameEnum.LEFT_LIGHT);
        list.add(CarStateNameEnum.RIGHT_LIGHT);
//        list.add(MonitorParameterName.FOGLIGHT);
        return list;
    }

    /**
     * 给TextView动态设置drawableLeft
     */
    public static void setTextDrawableLeft(Context context, TextView tv, int resId) {
        Drawable drawable = context.getResources().getDrawable(resId);
        drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
        tv.setCompoundDrawables(drawable, null, null, null);
    }

    /**
     * 给RadioButton动态设置drawableLeft
     */
    public static void setTextDrawableLeft(Context context, RadioButton rb, int resId) {
        Drawable drawable = context.getResources().getDrawable(resId);
        drawable.setBounds(0, 0, (int) (drawable.getMinimumWidth() / DensityUtil.getScreenDensity(context) * 1.25), (int) (drawable.getMinimumHeight() / DensityUtil.getScreenDensity(context) * 1.25));
        rb.setCompoundDrawables(drawable, null, null, null);
    }

    /**
     * 给RadioButton动态设置drawableTop
     */
    public static void setTextDrawableTop(Context context, RadioButton rb, int resId) {
        Drawable drawable = context.getResources().getDrawable(resId);
        drawable.setBounds(0, 0, (int) context.getResources().getDimension(R.dimen.dp_30), (int) context.getResources().getDimension(R.dimen.dp_30));
        rb.setCompoundDrawables(null, drawable, null, null);
    }
}
